package D240528;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Properties;
import java.util.Scanner;

public class ExceptionDemo {
    public static void main(String[] args)  {
        // java.lang.StackOverflowError
        //在之前学习递归时出现

        // java.lang.OutOfMemoryError
        String[] integers = new String[1024 * 1024 * 1024];


        // java.lang.ArrayIndexOutOfBoundsException
        int[] is = new int[] {1, 2, 3};
        System.out.println(is[3]);


        // java.lang.NumberFormatException
        Integer.parseInt("B");


        // java.lang.ArithmeticException: / by zero
        int i = 3 / 0;


        // java.lang.NullPointerException
        String s = null;
        System.out.println(s.length());

        // java.io.FileNotFoundException
        //FileInputStream fileInputStream = new FileInputStream("config.properties");


        // java.io.IOException
        //Properties properties = new Properties();
        //properties.load(new FileInputStream("config.properties"));
    }
}
